// 这是路由模块

const express = require('express')

const router = express.Router()


// 挂载路由
router.get('/user/list', (req, resp) => {
    resp.send('get user list.')
})


router.post('/user/add', (req, resp) => {
    resp.send('add user success.')
})



router.get('/user/list2', (req, resp) => {

    const query = req.query
    console.log(query)

    resp.send({
        status: 0,
        msg: 'GET 请求成功',
        data: query
    })
})


router.post('/user/list2', (req, resp) => {

    const query = req.body
    console.log(query)

    resp.send({
        status: 0,
        msg: 'GET 请求成功',
        data: query
    })
})



// 向外导出
module.exports = router